assertXPath(pXml, "//textarray", 1);
}
-CPPUNIT_TEST_FIXTURE(SdExportTest, testExplodedPdfFont)
-{
- auto pPdfium = vcl::pdf::PDFiumLibrary::get();
- if (!pPdfium)
- return;
- UsePdfium aGuard;
-
- loadFromFile(u"pdf/differentfonts.pdf");
-
- setFilterOptions("{\"DecomposePDF\":{\"type\":\"boolean\",\"value\":\"true\"}}");
- setImportFilterName(TestFilter::FODG);
- saveAndReload(TestFilter::FODG);
-
- xmlDocUniquePtr pXml = parseLayout();
- {
- OUString sItalic = getXPath(pXml, "//font[2]", "italic");
- // was "none" before
- CPPUNIT_ASSERT_EQUAL(u"normal"_ustr, sItalic);
- // check that the others remain as expected
- OUString sFontName = getXPath(pXml, "//font[2]", "name");
- CPPUNIT_ASSERT_EQUAL(u"Liberation Serif"_ustr, sFontName);
- int nFontHeight = getXPath(pXml, "//font[2]", "height").toInt32();
- CPPUNIT_ASSERT_EQUAL(494, nFontHeight);
- }
-#if !defined _WIN32
- //TODO, debug this
- {
- OUString sWeight = getXPath(pXml, "//font[3]", "weight");
- // was "normal" before
- CPPUNIT_ASSERT_EQUAL(u"bold"_ustr, sWeight);
- // check that the others remain as expected
- OUString sFontName = getXPath(pXml, "//font[3]", "name");
- CPPUNIT_ASSERT_EQUAL(u"Liberation Sans"_ustr, sFontName);
- sal_Int32 nFontHeight = getXPath(pXml, "//font[3]", "height").toInt32();
- CPPUNIT_ASSERT_EQUAL(564, nFontHeight);
- }
-#endif
-}
-
-CPPUNIT_TEST_FIXTURE(SdExportTest, testExplodedPdfHindi)
-{
- auto pPdfium = vcl::pdf::PDFiumLibrary::get();
- if (!pPdfium)
- return;
- UsePdfium aGuard;
-
- loadFromFile(u"pdf/BasicHindi.pdf");
-
- setFilterOptions("{\"DecomposePDF\":{\"type\":\"boolean\",\"value\":\"true\"}}");
- save(TestFilter::FODG);
-
- xmlDocUniquePtr pXmlDoc = parseExportedFile();
-
- // Check that the English text in here is correct at least
-
- // ensure the expected content
- assertXPathContent(pXmlDoc,
- "/office:document/office:body/office:drawing/draw:page/draw:g/draw:frame[3]/"
- "draw:text-box/text:p[@text:style-name='P4'][1]",
- u"FIRST-YEAR HINDI COURSE");
-
- // ensure the expected font name
- assertXPath(pXmlDoc, "/office:document/office:automatic-styles/style:style[@style:name='P4']/"
- "style:text-properties[@style:font-name='AcademyEngravedLetPlain']");
-}
-
CPPUNIT_TEST_FIXTURE(SdExportTest, testExplodedPdfGrayscaleImageUnderInvisibleTest)
{
auto pPdfium = vcl::pdf::PDFiumLibrary::get();
}
}
-CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf154104)
-{
- ScopedVclPtrInstance<VirtualDevice> pOutDev;
-
- vcl::Font aBaseFont{ u"David Libre"_ustr, u"Regular"_ustr, Size{ 0, 72 } };
- pOutDev->SetFont(aBaseFont);
-
- vcl::Font aFallbackFont{ u"Noto Sans Arabic"_ustr, u"Regular"_ustr, Size{ 0, 72 } };
- pOutDev->ForceFallbackFont(aFallbackFont);
-
- pOutDev->SetLayoutMode(vcl::text::ComplexTextLayoutFlags::BiDiRtl
- | vcl::text::ComplexTextLayoutFlags::BiDiStrong);
-
- auto aText = u"\u05D0\u05D0\u05D0\u0644\u0627"_ustr;
- KernArray aKernArray = { 100, 200, 300, 350, 400 };
- auto pLayout = pOutDev->ImplLayout(aText, /*nIndex*/ 0, /*nLen*/ aText.getLength(),
- /*rLogicPos*/ Point(0, 0), /*nLogicWidth*/ 0, aKernArray);
-
- // Fallback must have happened for this test to be meaningful
- auto pMultiLayout = dynamic_cast<MultiSalLayout*>(pLayout.get());
- CPPUNIT_ASSERT(pMultiLayout);
-
- std::vector<double> aCharX;
-
- const GlyphItem* pGlyph = nullptr;
- basegfx::B2DPoint stPos;
- int nCurrPos = 0;
- while (pLayout->GetNextGlyph(&pGlyph, stPos, nCurrPos))
- {
- aCharX.push_back(stPos.getX());
- }
-
- // tdf#154104 caused overlapping glyphs in fallback runs:
- // { -295.0, -195.0, -95.0, -341.0 }
- std::vector<double> aRefCharX{ -245.0, -145.0, -45.0, -341.0 };
-
- CPPUNIT_ASSERT_EQUAL(aRefCharX.size(), aCharX.size());
- for (size_t i = 0; i < aRefCharX.size(); ++i)
- {
- CPPUNIT_ASSERT_DOUBLES_EQUAL(aRefCharX.at(i), aCharX.at(i), /*delta*/ 0.2);
- }
-}
-
CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf163761)
{
ScopedVclPtrInstance<VirtualDevice> pOutDev;